<template>
  <view class="form-box">
    <!--<nui-step :step="0"></nui-step>-->
    <nui-step :step="stepType"></nui-step>
    <u-form :model="form" ref="uForm">
      <u-form-item label="手机号码" label-width="180" prop="mobile" required
      >
        <u-input v-model="form.mobile" maxlength="11" :disabled="true"
        />
      </u-form-item>
      <u-form-item label="身份证姓名" label-width="180" prop="identity_name" required
      >
        <u-input v-model="form.identity_name" placeholder="请输入身份证姓名" :disabled="this.disabledFlag"
        />
      </u-form-item>
      <u-form-item v-if="showIdCard" label="身份证号码" label-width="180" prop="identity_number" :required="reqIdCard"
      >
        <u-input v-model="form.identity_number" placeholder="请输入身份证号码" :disabled="this.disabledFlag"
        />
      </u-form-item>
      <u-form-item v-if="showIdCardAddress" label="身份证地址" label-width="180" prop="idCardAddress" :required="reqIdCardAddress"
      >
        <u-input v-model="form.idCardAddress" placeholder="请输入身份证地址"
        />
      </u-form-item>
      <u-form-item v-if="showIssuingAuthority" label="签发机关" label-width="180" prop="issuingAuthority" :required="reqIssuingAuthority"
      >
        <u-input v-model="form.issuingAuthority" placeholder="请输入签发机关"
        />
      </u-form-item>
      <view @click="showIdCardBeginDatePick = true">
        <u-form-item @click="showIdCardBeginDatePick = true" v-if="showIdCardBeginDate" label="身份证有效起期"
                     label-width="200" prop="idCardBeginDate"
                     :required="reqIdCardBeginDate"
        >
          <text :style="{color:(form.idCardBeginDate?'#303133': '#C0C4CC')}">{{ getIdCardBeginDate }}</text>
          <u-picker v-model="showIdCardBeginDatePick" mode="time" @confirm="onIdCardBeginDateConfirm"></u-picker>
        </u-form-item>
      </view>
      <view @click="onIdCardEndDateClick" >
        <u-form-item v-if="showIdCardEndDate" label="身份证有效止期"
                     label-width="200" prop="idCardEndDate"
                     :disabled = 'form.isLongIdCard === 1'
                     :required="reqIdCardEndDate"
        >
          <text :style="{color:(form.idCardEndDate?'#303133': '#C0C4CC')}">{{ getIdCardEndDate }}</text>
          <u-picker v-model="showIdCardEndDatePick" mode="time" @confirm="onIdCardEndDateConfirm"></u-picker>
        </u-form-item>
      </view>
      <u-form-item v-if="showIdCardEndDate" label-width="200" label="是否长期身份证">
        <u-radio-group v-if="showIdCardEndDate" v-model="form.isLongIdCard">
          <u-radio
            @change="longIdCardChange"
            v-for="(item, index) in longIdCardRadio" :key="index"
            :name="item.id"
          >
            {{item.name}}
          </u-radio>
        </u-radio-group>
      </u-form-item>
      <u-form-item v-if="showBankNo" :label="bankNoLabel" :label-position="labelPosition" prop="bank_cardno"
                   :required="reqBankNo"
      >
        <u-input v-model="form.bank_cardno" placeholder="请输入开户银行卡号" @blur="vailCard"
        />
      </u-form-item>
      <u-form-item v-if="showBankAccountName" :label="bankAccountNameLabel" :label-position="labelPosition" prop="bankAccountName"
                   :required="reqBankAccountName"
      >
          <u-input v-model="form.bankAccountName" :placeholder="'请输入' + bankAccountNameLabel"
          />
      </u-form-item>
      <u-form-item v-if="showBankNo" :label="bankNameLabel" :label-position="labelPosition" prop="bank_name"
                   :required="reqBankNo"
      >
        <u-input
            v-model="form.bank_name"
            type="select"
            :select-open="actionNameShow"
            @click="actionNameShow = true"
            placeholder="请选择银行卡开户银行"
        />
      </u-form-item>
      <u-form-item v-if="showBankBranch" label-width="200" label="开户行支行名称" prop="bankBranch"
                   :required="reqBankBranch"
      >
        <u-input
          v-model="form.bankBranch"
          placeholder="请填写开户行支行名称"
        />
      </u-form-item>
      <view @click="showBankCardAreaPick = true">
        <u-form-item @click="showBankCardAreaPick = true" v-if="showBankCardArea" label="银行卡所属省份"
                     :label-position="labelPosition" prop="bankCardArea"
                     :required="reqBankCardArea"
        >
          <text :style="{color:(form.bankCardArea?'#303133': '#C0C4CC')}">{{ getBankCardArea }}</text>
          <u-picker v-model="showBankCardAreaPick" mode="region" @confirm="onBankCardAreaConfirm"></u-picker>
        </u-form-item>
      </view>
      <u-form-item v-if="showHomeAddress" label="联系地址" label-width="180" prop="homeAddress"
                   :required="reqHomeAddress"
      >
        <u-input v-model="form.homeAddress" placeholder="请输入联系住址"
        />
      </u-form-item>
      <u-form-item v-if="showAccountNature" label="户口性质" label-width="180" prop="accountNature"
                   :required="reqAccountNature"
      >
          <u-input
                  v-model="form.accountNature"
                  type="select"
                  :select-open="showAccountNatureSel"
                  @click="showAccountNatureSel = true"
                  placeholder="请选择户口性质"
          />
      </u-form-item>
      <u-form-item v-if="showAccountLocation" label="户口地址" label-width="180" prop="accountLocation"
                   :required="reqAccountLocation"
      >
        <u-input v-model="form.accountLocation" placeholder="请输入户口住址"
        />
      </u-form-item>
      <u-form-item v-if="showInductionProvince" label="入职城市" label-width="180" prop="inductionProvince"
                   :required="reqInductionProvince"
      >
        <u-input v-model="form.inductionProvince" placeholder="请输入入职城市"
        />
      </u-form-item>
      <u-form-item v-if="showChannel" label="入职渠道" label-width="180" prop="channel" :required="reqChannel">
        <u-input
            type="select"
            v-model="form.channel"
            placeholder="请选择入职渠道"
            @click="showPickerMax1($event)"
        ></u-input
        >
      </u-form-item>
      <u-form-item v-if="showStaffType" label="员工类型" label-width="180" prop="staffTypeDesc"
                   :required="reqStaffType">
        <u-input
            type="select"
            v-model="form.staffTypeDesc"
            placeholder="请选择员工类型"
            @click="showStaffTypeSelect = true"
        ></u-input
        >
        <u-select v-model="showStaffTypeSelect" :list="staffTypeList" @confirm="onStaffTypeConfirm"></u-select>
      </u-form-item>
      <view v-if="checkChannel.id && verifyRecommendChannel(checkChannel.id)">
        <u-form-item label="推荐人" label-width="180" prop="referrer_name" :required="reqReferrerName"
        >
          <u-input v-model="form.referrer_name" placeholder="请输入推荐人姓名"
          />
        </u-form-item>
        <u-form-item label="推荐人ID" label-width="180" prop="referrer_id" :required="reqReferrerId"
                     v-show="reqReferrerId"
        >
          <u-input v-model="form.referrer_id" placeholder="请输入推荐人ID"
          />
        </u-form-item>
        <u-form-item label="推荐人电话" label-width="180" prop="referrer_mobile" :required="reqReferrerMobile"
        >
          <u-input v-model="form.referrer_mobile" placeholder="请输入推荐人手机号码"
          />
        </u-form-item>
      </view>
      <view v-if="checkChannel.id && verifyRecommendThirtyChannel(checkChannel.id)">
        <u-form-item label="推荐公司名称" label-width="180" prop="referrer_company" :required="reqThirtyCompany"
        >
          <u-input v-model="form.referrer_company" placeholder="请输入推荐公司名称"
          />
        </u-form-item>
      </view>
      <u-form-item v-if="showSite" :label="showSiteLabel" label-width="180" prop="site" :required="reqSite"
      >
        <u-input type="select" v-model="form.site" :placeholder="'请选择' + showSiteLabel"
                 @click="showPickerMax($event)"></u-input
        >
      </u-form-item>

      <u-form-item v-if="showMaritalStatus" label="婚姻状况" label-width="180" prop="maritalStatus"
                   :required="reqMaritalStatus"
      >
        <u-input
            v-model="form.maritalStatus"
            type="select"
            :select-open="showMaritalStatusSel"
            @click="showMaritalStatusSel = true"
            placeholder="请选择婚姻状况"
        />
      </u-form-item>

      <u-form-item v-if="showNation" label="民族" label-width="180" prop="nation"
                   :required="reqNation"
      >
        <u-input
            v-model="form.nation"
            type="select"
            :select-open="showNationSel"
            @click="showNationSel = true"
            placeholder="请选择民族"
        />
      </u-form-item>

      <u-form-item v-if="showHighestEdu" label="最高学历" label-width="180" prop="highestEdu"
                   :required="reqHighestEdu"
      >
        <u-input
            v-model="form.highestEdu"
            type="select"
            :select-open="showHighestEduSel"
            @click="showHighestEduSel = true"
            placeholder="请选择最高学历"
        />
      </u-form-item>
      <u-form-item v-if="showContact" label="紧急联系人姓名" label-width="180" prop="emergencyContact"
                   :required="reqContact"
      >
        <u-input v-model="form.emergencyContact" placeholder="请输入紧急联系人姓名"
        />
      </u-form-item>
      <u-form-item v-if="showContactPhone" label="紧急联系人电话" label-width="180" prop="contactsPhonenumber"
                   :required="reqContactPhone"
      >
        <u-input v-model="form.contactsPhonenumber" placeholder="请输入紧急联系人电话"
        />
      </u-form-item>

      <u-form-item v-if="showContact" label="与紧急联系人的关系" label-width="180" prop="contactsRelation"
                   :required="reqContact"
      >
        <u-input
            v-model="form.contactsRelation"
            type="select"
            :select-open="showContactRelationSel"
            @click="showContactRelationSel = true"
            placeholder="请选择与紧急联系人的关系"
        />
      </u-form-item>

      <u-form-item v-if="showStorehouseRelativesName" label="仓内亲属姓名" label-width="180"
                   prop="storehouseRelativesName"
                   :required="reqStorehouseRelativesName"
      >
        <u-input v-model="form.storehouseRelativesName" placeholder="请输入仓内亲属姓名"
        />
      </u-form-item>

      <u-form-item v-if="showStorehouseRelativesPost" label="亲属仓内岗位" label-width="180"
                   prop="storehouseRelativesPost"
                   :required="reqStorehouseRelativesPost"
      >
        <u-input v-model="form.storehouseRelativesPost" placeholder="请输入亲属仓内岗位"
        />
      </u-form-item>

      <u-form-item v-if="showStorehouseRelativesRelationship" label="仓内亲属关系" label-width="180"
                   prop="storehouseRelativesRelationship"
                   :required="reqStorehouseRelativesRelationship"
      >
        <u-input
            v-model="form.storehouseRelativesRelationship"
            type="select"
            :select-open="showStorehouseRelativesRelationshipSel"
            @click="showStorehouseRelativesRelationshipSel = true"
            placeholder="请选择与仓内亲属的关系"
        />
      </u-form-item>

      <u-form-item v-if="showInfoChannel" label-position="top" label="请问您是如何了解到这个岗位？" label-width="180"
                   prop="infoChannel"
                   :required="reqInfoChannel"
      >
        <u-input
            v-model="form.infoChannel"
            type="select"
            :select-open="showInfoChannelSel"
            @click="showInfoChannelSel = true"
            placeholder="请选择获取信息渠道"
        />
      </u-form-item>
      <u-form-item v-if="showPost" label="岗位名称" label-width="180" prop="post"
                   :required="reqPost"
      >
          <u-input v-model="form.post" placeholder="请输入岗位名称"
          />
      </u-form-item>

      <u-form-item v-if="showServiceCompanyRelativesName" label="服务公司亲属" label-width="180"
                   prop="serviceCompanyRelativesName"
                   :required="reqServiceCompanyRelativesName"
      >
        <u-input v-model="form.serviceCompanyRelativesName" placeholder="请输入服务公司亲属"
        />
      </u-form-item>
      <u-form-item v-if="showServiceCompanyRelativesRelationship" label="服务公司亲属关系" label-width="180"
                   prop="serviceCompanyRelativesRelationship"
                   :required="reqServiceCompanyRelativesRelationship"
      >
        <u-input
          v-model="form.serviceCompanyRelativesRelationship"
          type="select"
          :select-open="showServiceCompanyRelativesRelationshipSel"
          @click="showServiceCompanyRelativesRelationshipSel = true"
          placeholder="请选择服务公司亲属关系"
        />
      </u-form-item>
      <u-form-item v-if="showServiceCompanyRelativesPost" label="服务公司亲属岗位" label-width="180" prop="serviceCompanyRelativesPost"
                   :required="reqServiceCompanyRelativesPost"
      >
        <u-input v-model="form.serviceCompanyRelativesPost" placeholder="请输入岗位名称"
        />
      </u-form-item>

      <u-form-item v-if="showWorkplace" label="工作地点" label-width="180" prop="workplace"
                   :required="reqWorkplace"
      >
          <u-input v-model="form.workplace" placeholder="请输入工作地点"
          />
      </u-form-item>
      <u-form-item v-if="showUnifiedCode" label="社会信用统一代码" label-width="180" prop="unifiedCode"
                   :required="reqUnifiedCode"
      >
        <u-input v-model="form.unifiedCode" placeholder="社会信用统一代码"
        />
      </u-form-item>
      <u-form-item v-if="showCorporateAccount" label="对公账号" label-width="180" prop="corporateAccount"
                   :required="reqCorporateAccount"
      >
        <u-input v-model="form.corporateAccount" placeholder="对公账号"
        />
      </u-form-item>
      <u-form-item v-if="showAgentName" label="代理商(企业或个人)名称" label-width="180" prop="agentName"
                   :required="reqAgentName"
      >
          <u-input v-model="form.agentName" placeholder="请输入代理商名称"
          />
      </u-form-item>
      <u-form-item v-if="showBusinessAddress" label="经营地址" label-width="180" prop="businessAddress"
                   :required="reqBusinessAddress"
      >
          <u-input v-model="form.businessAddress" placeholder="请输入经营地址"
          />
      </u-form-item>
      <u-form-item v-if="showEmail" label="电子邮箱" label-width="180" prop="email"
                   :required="reqEmail"
      >
          <u-input v-model="form.email" placeholder="请输入电子邮箱"
          />
      </u-form-item>
      <u-form-item v-if="showSecondInterviewTime" label="复试时间" label-width="180"
                   prop="secondInterviewTime"
                   :required="reqSecondInterviewTime"
      >
        <u-input
            v-model="form.secondInterviewTime"
            type="select"
            :select-open="showSecondInterviewTimeCal"
            @click="showSecondInterviewTimeCal = true"
            placeholder="请选择复试时间"
        />
      </u-form-item>

      <u-form-item v-if="showHasCriminalRecord" label="是否有过犯罪记录" label-width="180"
                   label-position="top"
                   prop="hasCriminalRecord"
                   :required="reqHasCriminalRecord"
      >
          <u-radio-group v-model="form.hasCriminalRecord">
              <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
                  {{ item.dictLabel }}
              </u-radio>
          </u-radio-group>

      </u-form-item>

      <u-form-item v-if="showHealthClaim" label="员工健康声明" label-width="180"
                   label-position="top"
                   prop="healthClaim1"
                   :required="reqHealthClaim"
      >
        <div>是否身体已患病或住院治疗中？</div>
        <u-radio-group v-model="form.healthClaim1">
          <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
            {{ item.dictLabel }}
          </u-radio>
        </u-radio-group>

      </u-form-item>

      <u-form-item v-if="showHealthClaim" label="员工健康声明" label-width="180"
                   label-position="top"
                   prop="healthClaim2"
                   :required="reqHealthClaim"
      >
        <div>是否因身体不适而不能全勤工作或无法支撑仓内工作强度？</div>
        <u-radio-group v-model="form.healthClaim2">
          <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
            {{ item.dictLabel }}
          </u-radio>
        </u-radio-group>

      </u-form-item>

      <u-form-item v-if="showHealthClaim" label="员工健康声明" label-width="180"
                   label-position="top"
                   prop="healthClaim3"
                   :required="reqHealthClaim"
      >
        <div>
          现在或过去有无患有恶性肿瘤（癌、肉瘤、白血病）、精神病，癫痫、痴呆、脑血管硬化、心肌梗塞、高血压（二期以上）、心脏病（心功能不全二级以上）、支气管扩张、慢性阻塞性肺气肿、肺结核（传染期、慢性纤维空洞、肺变硬）、肝硬化、慢性肾炎、肾结核、肾病综合症、尿毒症、再生障碍性贫血、红斑狼疮、性病、艾滋病及其它先天性和遗传性疾病？
        </div>
        <u-radio-group v-model="form.healthClaim3">
          <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
            {{ item.dictLabel }}
          </u-radio>
        </u-radio-group>

      </u-form-item>

      <u-form-item v-if="showHealthClaim" label="员工健康声明" label-width="180"
                   label-position="top"
                   prop="healthClaim4"
                   :required="reqHealthClaim"
      >
        <div>女员工过去3个月内因妊娠、分娩而住院、手术等？</div>
        <u-radio-group v-model="form.healthClaim4">
          <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
            {{ item.dictLabel }}
          </u-radio>
        </u-radio-group>

      </u-form-item>

      <u-form-item v-if="showHealthClaim" label="员工健康声明" label-width="180"
                   label-position="top"
                   prop="healthClaim5"
                   :required="reqHealthClaim"
      >
        <div>过去患过职业病或工伤？</div>
        <u-radio-group v-model="form.healthClaim5">
          <u-radio v-for="(item, index) in yesOrNoList" :key="index" :name="item.dictLabel">
            {{ item.dictLabel }}
          </u-radio>
        </u-radio-group>

      </u-form-item>

    </u-form>
    <u-button type="primary" shape="square" :ripple="true" size="default" @click="submit" class="custom-btn"
              :disabled="disabledRegisterBtn" :loading="loadingRegisterBtn"
    >注册
    </u-button
    >
    <nui-picker
        ref="picker"
        :title="auiPicker.title"
        :layer="auiPicker.layer"
        :data="auiPicker.data"
        @callback="pickerCallback"
    ></nui-picker>
    <nui-picker
        ref="picker1"
        :title="auiPicker1.title"
        :layer="auiPicker1.layer"
        :data="auiPicker1.data"
        @callback="pickerCallback1"
    ></nui-picker>
    <u-modal
        v-model="showModel"
        content="确认注册？"
        @confirm="submitData"
        @cancel="cancel"
        show-cancel-button
    ></u-modal>
    <u-select
        v-model="actionNameShow"
        :list="actionNameList"
        mode="single-column"
        @confirm="actionNameCallback"
    ></u-select>
    <u-select
        v-model="showMaritalStatusSel"
        :list="maritalStatusList"
        mode="single-column"
        @confirm="selectedMaritalStatus"
    ></u-select>
    <u-select
        v-model="showNationSel"
        :list="nationList"
        mode="single-column"
        @confirm="selectedNation"
    ></u-select>
    <u-select
        v-model="showHighestEduSel"
        :list="highestEduList"
        mode="single-column"
        @confirm="selectedHighestEdu"
    ></u-select>
    <u-select
        v-model="showContactRelationSel"
        :list="contactRelationList"
        mode="single-column"
        @confirm="selectedContactRelation"
    ></u-select>
    <u-select
        v-model="showStorehouseRelativesRelationshipSel"
        :list="storehouseRelativesRelationshipList"
        mode="single-column"
        @confirm="selectedStorehouseRelativesRelationship"
    ></u-select>
    <u-select
      v-model="showServiceCompanyRelativesRelationshipSel"
      :list="serviceCompanyRelativesRelationshipList"
      mode="single-column"
      @confirm="selectedServiceCompanyRelativesRelationship"
    ></u-select>

    <u-select
        v-model="showInfoChannelSel"
        :list="infoChannelList"
        mode="single-column"
        @confirm="selectedInfoChannel"
    ></u-select>

    <u-select
            v-model="showAccountNatureSel"
            :list="accountNatureList"
            mode="single-column"
            @confirm="selectedAccountNature"
    ></u-select>

    <u-calendar v-model="showSecondInterviewTimeCal" @change="onSecondInterviewTimeChange"></u-calendar>
  </view>
</template>

<script>
import {getQueryString} from "@/utils/index.js";
import nuiPicker from "@/components/picker.vue";
import {mapGetters} from "vuex";
import AuthInfo from "@/utils/authInfo.js";
import store from "@/store";
import {getUrlParam, isEmpty} from "../../utils";

export default {
  components: {
    nuiPicker,
  },
  data() {
    return {
      disabledFlag: false,
      userInfo: {},
      vaildCard: false,
      showModel: false,
      auiPicker: {
        title: "选择站点",
        layer: null,
        data: [],
      },
      auiPicker1: {
        title: "选择渠道",
        layer: null,
        data: [],
      },
      siteItem: null,
      longIdCardRadio: [{name: '否', id: 0}, {name: '是', id: 1}],
      form: {
        mobile: "",
        identity_name: "",
        identity_number: "", //身份证号码
        site: "", //站点
        bank_cardno: "", //银行卡号
        bank_name: "", //开户银行
        bankBranch: "", // 开户行支行
        channel: "", //渠道
        referrer_name: "", //推荐人
        referrer_id: "",
        referrer_mobile: "",
        referrer_company: "",
        // 员工类型
        staffType: '',
        // 员工类型描述
        staffTypeDesc: '',
        // 联系地址
        homeAddress: "",
        // 银行卡所属省份
        bankCardProvince: null,
        // 银行卡所属城市
        bankCardCity: null,
        // 银行卡所属区域
        bankCardArea: null,
        // 婚姻状况
        maritalStatus: null,
        // 民族
        nation: null,
        // 最高学历
        highestEdu: null,
        // 户口性质
        accountNature: null,
        // 户口地址
        accountLocation: null,
        // 岗位名称
        post: null,
        // 工作地点
        workplace: null,
        // 入职城市
        inductionProvince: null,
        // 紧急联系人
        emergencyContact: null,
        // 紧急联系人关系
        contactsRelation: null,
        // 紧急联系人电话
        contactsPhonenumber: null,
        // 仓内亲属姓名
        storehouseRelativesName: null,
        // 仓内亲属关系
        storehouseRelativesRelationship: null,
        // 仓内亲属岗位
        storehouseRelativesPost: null,
        // 员工健康声明1
        healthClaim1: null,
        // 员工健康声明2
        healthClaim2: null,
        // 员工健康声明3
        healthClaim3: null,
        // 员工健康声明4
        healthClaim4: null,
        // 员工健康声明5
        healthClaim5: null,
        // 复试时间
        secondInterviewTime: null,
        // 获取信息渠道
        infoChannel: null,
        // 是否有过犯罪记录
        hasCriminalRecord: null,
        // 代理商名称
        agentName: null,
        // 社会信用统一代码
        unifiedCode: null,
        // 对公账号
        corporateAccount: null,
        // 经营地址
        businessAddress: null,
        // 电子邮箱
        email: null,
        // 银行账户名称
        bankAccountName: null,
        // 身份证地址
        idCardAddress: null,
        // 签发机关
        issuingAuthority: null,
        // 身份证有效起期
        idCardBeginDate: null,
        // 身份证有效止期
        idCardEndDate: null,
        // 是否长期身份证
        isLongIdCard: 0,
      },
      actionNameShow: false,
      actionNameList: [],
      // 是否显示婚姻状况选择
      showMaritalStatusSel: false,
      // 是否显示民族选择
      showNationSel: false,
      // 是否显示最高学历选择
      showHighestEduSel: false,
      // 是否显示紧急联系人关系选择
      showContactRelationSel: false,
      // 是否显示仓内亲属关系选择
      showStorehouseRelativesRelationshipSel: false,
      // 是否显示服务公司亲属关系选择
      showServiceCompanyRelativesRelationshipSel: false,
      // 是否显示获取信息渠道选择
      showInfoChannelSel: false,
      // 是否显示户口性质选择
      showAccountNatureSel: false,
      // 婚姻状况列表
      maritalStatusList: [],
      // 民族列表
      nationList: [],
      // 最高学历列表
      highestEduList: [],
      // 紧急联系人关系列表
      contactRelationList: [],
      // 仓内亲属关系列表
      storehouseRelativesRelationshipList: [],
      // 服务公司亲属关系列表
      serviceCompanyRelativesRelationshipList: [],
      // 获取信息渠道列表
      infoChannelList: [],
      // 户口性质列表
      accountNatureList: [],
      // 员工类型列表
      staffTypeList: [],
      // 是否列表
      yesOrNoList: [{dictValue: 'Y', dictLabel: '是'}, {dictValue: 'N', dictLabel: '否'}],
      // 是否显示员工类型下拉选择
      showStaffTypeSelect: false,
      checkBankName: {},
      // 婚姻状况
      checkMaritalStatus: {},
      // 民族
      checkNation: {},
      // 最高学历
      checkHighestEdu: {},
      // 紧急联系人关系
      checkContactRelation: {},
      // 户口性质
      checkAccountNature: {},
      // 仓内亲属关系
      checkStorehouseRelativesRelationship: {},
      // 服务公司亲属关系
      checkServiceCompanyRelativesRelationship: {},
      // 获取信息渠道
      checkInfoChannel: {},
      labelPosition: "top",
      checkChannel: {}, //选中的入职渠道
      initData: null,
      // url部门Id
      urlDeptId: null,
      rules: {
        channel: [
          {
            required: true,
            message: "请选择入职渠道",
            trigger: "change",
          },
        ],
        bank_name: [
          {
            required: true,
            message: "请选择银行卡开户银行",
            trigger: ["change", "blur"],
          },
        ],
        bank_cardno: [
          {
            required: true,
            message: "请输入开户银行卡号",
            trigger: ["change", "blur"],
          },
        ],
        mobile: [
          {
            required: true,
            message: "请输入手机号",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return this.$u.test.mobile(value);
            },
            message: "手机号码不正确",
            trigger: ["change", "blur"],
          },
        ],
        identity_name: [
          {
            required: true,
            message: "请输入身份证姓名",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return !/^[0-9]+.?[0-9]*$/.test(value);
            },
            message: "身份证姓名不正确",
            trigger: ["change", "blur"],
          },
        ],
        identity_number: [
          {
            required: true,
            message: "请输入身份证号码",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return this.$u.test.idCard(value);
            },
            message: "身份证号码不正确",
            trigger: ["change", "blur"],
          },
        ],
        idCardAddress: [{required: true, message: "请输入身份证地址", trigger: ["change", "blur"],},],
        issuingAuthority: [{required: true, message: "请输入签发机关", trigger: ["change", "blur"]}],
        idCardBeginDate: [{required: true, message: "请选择身份证有效起期", trigger: ["change", "blur"]}],
        idCardEndDate: [{required: true, message: "请选择身份证有效止期", trigger: ["change", "blur"]}],
        bankBranch: [{required: true, message: "请填写开户行支行", trigger: ["change", "blur"]}],
        site: [
          {
            required: true,
            message: "请选择站点",
            trigger: "change",
          },
        ],
        homeAddress: [
          {
            required: false,
            message: "请填写联系地址",
            trigger: "change",
          },
        ],
        bankCardArea: [
          {
            required: false,
            message: "请选择银行卡所属省份",
            trigger: "change",
          },
        ],
        staffTypeDesc: [
          {
            required: false,
            message: "请选择员工类型",
            trigger: "change",
          }
        ],
        maritalStatus: [
          {
            required: false,
            message: "请选择婚姻状况",
            trigger: "change",
          }
        ],
        nation: [
          {
            required: false,
            message: "请选择民族",
            trigger: "change",
          }
        ],
        highestEdu: [
          {
            required: false,
            message: "请选择最高学历",
            trigger: "change",
          }
        ],
        accountLocation: [
          {
            required: false,
            message: "请填写户口地址",
            trigger: "change",
          }
        ],
        accountNature: [
            {
                required: false,
                message: "请填写户口性质",
                trigger: "change",
            }
        ],
        emergencyContact: [
          {
            required: false,
            message: "请填写紧急联系人",
            trigger: "change",
          }
        ],
        contactsRelation: [
          {
            required: false,
            message: "请选择与紧急联系人的关系",
            trigger: "change",
          }
        ],
        contactsPhonenumber: [
          {
            required: false,
            message: "请输入紧急联系人手机号",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return this.$u.test.mobile(value);
            },
            message: "手机号码不正确",
            trigger: ["change", "blur"],
          },
        ],
        storehouseRelativesName: [
          {
            required: false,
            message: "请输入仓内亲属姓名",
            trigger: ["change", "blur"],
          },
        ],
        storehouseRelativesPost: [
          {
            required: false,
            message: "请输入仓内亲属岗位",
            trigger: ["change", "blur"],
          },
        ],
        storehouseRelativesRelationship: [
          {
            required: false,
            message: "请选择仓内亲属关系",
            trigger: ["change", "blur"],
          },
        ],
        serviceCompanyRelativesName: [
          {
            required: false,
            message: "请输入服务公司亲属姓名",
            trigger: ["change", "blur"],
          },
        ],
        serviceCompanyRelativesPost: [
          {
            required: false,
            message: "请输入服务公司亲属岗位",
            trigger: ["change", "blur"],
          },
        ],
        serviceCompanyRelativesRelationship: [
          {
            required: false,
            message: "请选择服务公司亲属关系",
            trigger: ["change", "blur"],
          },
        ],
        healthClaim1: [
          {
            required: false,
            message: "请选择",
            trigger: ["change", "blur"],
          },
        ],
        healthClaim2: [
          {
            required: false,
            message: "请选择",
            trigger: ["change", "blur"],
          },
        ],
        healthClaim3: [
          {
            required: false,
            message: "请选择",
            trigger: ["change", "blur"],
          },
        ],
        healthClaim4: [
          {
            required: false,
            message: "请选择",
            trigger: ["change", "blur"],
          },
        ],
        healthClaim5: [
          {
            required: false,
            message: "请选择",
            trigger: ["change", "blur"],
          },
        ],
        secondInterviewTime: [
          {
            required: false,
            message: "请选择复试时间",
            trigger: ["change", "blur"],
          },
        ],
        inductionProvince: [
          {
            required: false,
            message: "请填写入职城市",
            trigger: "change",
          }
        ],
        infoChannel: [
          {
            required: false,
            message: "请选择获取信息渠道",
            trigger: "change",
          }
        ],
        post: [
          {
              required: false,
              message: "请填写岗位名称",
              trigger: "change",
          }
        ],
        workplace: [
          {
              required: false,
              message: "请填写工作地点",
              trigger: "change",
          }
        ],
        hasCriminalRecord: [
          {
              required: false,
              message: "请选择是否有过犯罪记录",
              trigger: "change",
          }
        ],
        unifiedCode: [
          {
            required: false,
            message: "请填写社会信用统一代码",
            trigger: "change",
          }
        ],
        corporateAccount: [
          {
            required: false,
            message: "请填写对公账号",
            trigger: "change",
          }
        ],
        agentName: [
            {
                required: false,
                message: "请填写代理商名称",
                trigger: "change",
            }
        ],
        businessAddress: [
            {
                required: false,
                message: '请填写经营地址',
                trigger: 'change'
            }
        ],
        email: [
            {
                required: false,
                message: '请填写电子邮箱',
                trigger: 'change'
            },
            {
                validator: (rule, value, callback) => {
                    if (this.reqEmail){
                        return this.$u.test.email(value)
                    }
                    callback()
                },
                message: "电子邮箱不正确",
                trigger: ["change", "blur"],
            },
        ],
        bankAccountName: [
            {
                required: false,
                message: '请填写银行账户名称',
                trigger: 'change'
            }
        ],
      },
      // 推荐人必填
      reqReferrerName: false,
      // 推荐人ID必填
      reqReferrerId: false,
      // 推荐人电话必填
      reqReferrerMobile: false,
      //推荐公司名称必填
      reqThirtyCompany: false,
      // 银行卡必填
      reqBankNo: true,
      // 银行卡label
      bankNoLabel: '工资卡开户银行卡号',
      // 开户银行label
      bankNameLabel: '工资卡开户银行',
      // 是否显示银行卡
      showBankNo: true,
      // 是否显示开户行支行
      showBankBranch: false,
      // 是否必填开户行支行
      reqBankBranch: false,
      // 入职渠道是否必填
      reqChannel: true,
      // 是否显示入职渠道
      showChannel: true,
      // 入职渠道表填
      showChannelLabel: '入职渠道',
      // 是否显示员工类型
      showStaffType: false,
      // 员工类型是否必填
      reqStaffType: false,
      // 站点是否必填
      reqSite: true,
      // 是否显示站点
      showSite: true,
      // 站点标题
      showSiteLabel: '站点/大仓',
      // 身份证地址是否必填
      reqIdCardAddress: false,
      // 是否显示身份证地址
      showIdCardAddress: false,
      // 签发机关是否必填
      reqIssuingAuthority: false,
      // 签发机关是否显示
      showIssuingAuthority: false,
      // 身份证有效起期是否必填
      reqIdCardBeginDate: false,
      // 身份证有效起期是否显示
      showIdCardBeginDate: false,
      // 身份证有效止期是否必填
      reqIdCardEndDate: false,
      // 身份证有效止期是否显示
      showIdCardEndDate: false,
      // 是否显示身份证有效起期pick
      showIdCardBeginDatePick: false,
      // 是否显示身份证有效止期pick
      showIdCardEndDatePick: false,
      // 联系地址是否必填
      reqHomeAddress: false,
      // 是否显示联系地址
      showHomeAddress: false,
      // 是否显示银行卡所属地
      showBankCardArea: false,
      // 是否显示婚姻状况
      showMaritalStatus: false,
      // 是否显示民族
      showNation: false,
      // 是否显示最高学历
      showHighestEdu: false,
      // 婚姻状况是否必填
      reqMaritalStatus: false,
      // 民族是否必填
      reqNation: false,
      // 最高学历是否必填
      reqHighestEdu: false,
      // 是否显示户口性质
      showAccountNature: false,
      // 户口性质是否必填
      reqAccountNature: false,
      // 户口地址是否必填
      reqAccountLocation: false,
      // 是否显示户口地址
      showAccountLocation: false,
      // 是否显示入职省份
      showInductionProvince: false,
      // 入职省份是否必填
      reqInductionProvince: false,
      // 紧急联系人是否必填
      reqContact: false,
      // 是否显示紧急联系人
      showContact: false,
      // 紧急联系人电话是否必填
      reqContactPhone: false,
      // 是否显示紧急联系人电话
      showContactPhone: false,
      // 是否显示仓内亲属姓名
      showStorehouseRelativesName: false,
      // 仓内亲属姓名是否必填
      reqStorehouseRelativesName: false,
      // 是否显示仓内亲属岗位
      showStorehouseRelativesPost: false,
      // 仓内亲属岗位是否必填
      reqStorehouseRelativesPost: false,
      // 是否显示仓内亲属关系
      showStorehouseRelativesRelationship: false,
      //  仓内亲属关系是否必填
      reqStorehouseRelativesRelationship: false,
      // 是否显示服务公司亲属姓名
      showServiceCompanyRelativesName: false,
      // 是否显示服务公司亲属关系
      showServiceCompanyRelativesRelationship: false,
      // 是否显示服务公司岗位
      showServiceCompanyRelativesPost: false,
      // 服务公司亲属姓名是否必填
      reqServiceCompanyRelativesName: false,
      // 服务公司亲属关系是否必填
      reqServiceCompanyRelativesRelationship: false,
      // 服务公司岗位是否必填
      reqServiceCompanyRelativesPost: false,
      // 是否显示员工健康声明
      showHealthClaim: false,
      // 员工健康声明是否必填
      reqHealthClaim: false,
      // 是否显示复试时间
      reqSecondInterviewTime: false,
      // 复试时间是否必填
      showSecondInterviewTime: false,
      // 是否显示复试时间日历
      showSecondInterviewTimeCal: false,
      // 是否显示获取信息渠道
      showInfoChannel: false,
      //  获取信息渠道是否必填
      reqInfoChannel: false,
      // 银行卡所属地是否必填
      reqBankCardArea: false,
      // 是否显示岗位名称
      showPost: false,
      // 岗位名称是否必填
      reqPost: false,
      // 是否显示工作地点
      showWorkplace: false,
      // 工作地点是否必填
      reqWorkplace: false,
      // 是否显示代理商名称
      showAgentName: false,
      // 代理商名称是否必填
      reqAgentName: false,
      // 是否显示社会信用统一代码
      showUnifiedCode: false,
      // 社会信用统一代码是否必填
      reqUnifiedCode: false,
      // 是否显示对公账号
      showCorporateAccount: false,
      // 对公账号是否必填
      reqCorporateAccount: false,
      // 是否显示经营地址
      showBusinessAddress: false,
      // 经营地址是否必填
      reqBusinessAddress: false,
      // 是否显示电子邮箱
      showEmail: false,
      // 电子邮箱是否必填
      reqEmail: false,
      // 是否显示身份证
      showIdCard: true,
      // 身份证是否必填
      reqIdCard: true,
      // 是否显示银行账户名称
      showBankAccountName: false,
      // 银行账户名称是否必填
      reqBankAccountName: false,
      // 银行卡账户名称label
      bankAccountNameLabel: '银行账户名称',
      // 是否显示犯罪记录
      showHasCriminalRecord: false,
      // 犯罪记录是否必填
      reqHasCriminalRecord: false,
      // 是否显示银行卡所属地picker
      showBankCardAreaPick: false,
      // 是否禁用注册按钮
      disabledRegisterBtn: false,
      // 注册按钮是否处于loading
      loadingRegisterBtn: false,
      doubleClick:false,
    };
  },
  onLoad() {
  },
  async mounted() {
    await this.getInit();
    await this.getSite();
    // 新速达优选全职临时隐藏银行卡信息
    if (this.initData.companyId && (((this.initData.companyId === 521) && this.urlDeptId === '6652' && this.form.staffType === '1')
      || ((this.initData.companyId === 7016) && this.urlDeptId === '7021' && this.form.staffType === '1' ))) {
      this.rules.bank_name[0].required = false
      this.reqBankCardArea = false
      this.showBankCardArea = false
      this.rules.bankCardArea[0].required = false
      this.$refs.uForm.setRules(this.rules)
    }
    // 新速达优选兼职临时隐藏
    if (this.initData.companyId && (((this.initData.companyId === 521) && this.urlDeptId === '6652' && this.form.staffType === '2'))
    || ((this.initData.companyId === 7016) && this.urlDeptId === '7021' && this.form.staffType === '2')) {
      this.showNation = false
      this.reqNation = false
      this.rules.nation[0].required = false
      this.showMaritalStatus = false
      this.reqMaritalStatus = false
      this.rules.maritalStatus[0].required = false
      this.showHighestEdu = false
      this.reqHighestEdu = false
      this.rules.highestEdu[0].required = false
      this.rules.contactsRelation[0].required = false
      this.showStorehouseRelativesName = false
      this.reqStorehouseRelativesName = false
      this.rules.storehouseRelativesName[0].required = false
      this.showStorehouseRelativesPost = false
      this.reqStorehouseRelativesPost = false
      this.rules.storehouseRelativesPost[0].required = false
      this.showStorehouseRelativesRelationship = false
      this.reqStorehouseRelativesRelationship = false
      this.rules.storehouseRelativesRelationship[0].required = false
      this.showHealthClaim = false
      this.reqHealthClaim = false
      this.rules.healthClaim1[0].required = false
      this.rules.healthClaim2[0].required = false
      this.rules.healthClaim3[0].required = false
      this.rules.healthClaim4[0].required = false
      this.rules.healthClaim5[0].required = false
      this.showBankNo = false
      this.reqBankNo = false
      this.rules.bank_cardno[0].required = false
      this.showBankAccountName = false
      this.reqBankAccountName = false
      this.rules.bankAccountName[0].required = false
      this.showBankCardArea = false
      this.reqBankCardArea = false
      this.rules.bankCardArea[0].required = false
      this.$refs.uForm.setRules(this.rules)
    }
    // 新速达挂靠业务网格仓,修改站点/大仓为入职站点
    if (this.initData.companyId && (this.initData.companyId === 521) && (this.urlDeptId === '6665' || this.urlDeptId === '6652')) {
        this.bankAccountNameLabel = '银行卡户主姓名'
        this.rules.bankAccountName[0].message = '请填写银行卡户主姓名'
    }
    if (this.initData.companyId && (this.initData.companyId === 7016) && (this.urlDeptId === '7022' || this.urlDeptId === '7021')) {
      this.bankAccountNameLabel = '银行卡户主姓名'
      this.rules.bankAccountName[0].message = '请填写银行卡户主姓名'
    }

    const abutmentVo = uni.getStorageSync("abutmentVo")
    // let abutmentVo = store.getters.abutmentVo ? store.getters.abutmentVo : []
    console.log('abutmentVo====>>',JSON.stringify(abutmentVo[0]))
    if (!isEmpty(abutmentVo) && !isEmpty(abutmentVo[0])) {
      this.form.identity_number = abutmentVo[0].certno
      this.form.bank_cardno = abutmentVo[0].cardno
    }
  },
  computed: {
    ...mapGetters(["openId", "stepType", 'qrCodeType', 'staffType', 'qrCodeId']),
    // 计算银行卡所属省份
    getBankCardArea() {
      if (!this.form.bankCardProvince || !this.form.bankCardCity || !this.form.bankCardCity) {
        return '请选择银行卡所属省份'
      }
      return `${this.form.bankCardProvince}-${this.form.bankCardCity}-${this.form.bankCardArea}`
    },
    // 计算身份证有效起期
    getIdCardBeginDate() {
      if (!this.form.idCardBeginDate) {
        return '请选择身份证有效起期'
      }
      return this.form.idCardBeginDate
    },
    // 计算身份证有效止期
    getIdCardEndDate() {
      if (!this.form.idCardEndDate) {
        return '请选择身份证有效止期'
      }
      return this.form.idCardEndDate
    }
  },
  methods: {
    //显示picker多级联动弹窗
    showPickerMax1(e) {
      const _this = this;
      _this.auiPicker.layer = null;
      _this.$refs.picker1.open();
    },
    //picker多级联动回调
    pickerCallback1(e) {
      let data = e.data;
      // 获取员工类型
      this.form.staffType = e.data[0].id
      this.handleBldBank(e.data)
      this.checkChannel = data[data.length - 1];
      this.form.channel = this.checkChannel.label;
    },
    actionNameCallback(e) {
      this.form.bank_name = e[0].label;
      this.checkBankName = e[0];
    },
    selectedMaritalStatus(e) {
      this.form.maritalStatus = e[0].label
      this.checkMaritalStatus = e[0]
    },
    selectedNation(e) {
      this.form.nation = e[0].label
      this.checkNation = e[0]
    },
    selectedHighestEdu(e) {
      this.form.highestEdu = e[0].label
      this.checkHighestEdu = e[0]
    },
    selectedContactRelation(e) {
      this.form.contactsRelation = e[0].label
      this.checkContactRelation = e[0]
    },
    selectedStorehouseRelativesRelationship(e) {
      this.form.storehouseRelativesRelationship = e[0].label
      this.checkStorehouseRelativesRelationship = e[0]
    },
    selectedServiceCompanyRelativesRelationship(e) {
      this.form.serviceCompanyRelativesRelationship = e[0].label
      this.checkServiceCompanyRelativesRelationship = e[0]
    },
    selectedInfoChannel(e) {
      this.form.infoChannel = e[0].label
      this.checkInfoChannel = e[0]
    },
    selectedAccountNature(e) {
        this.form.accountNature = e[0].label
        this.checkAccountNature = e[0]
    },
    onSecondInterviewTimeChange(result) {
      this.form.secondInterviewTime = result.result
    },
    vailCard() {
      // 银行卡白名单
      if (this.form.bank_cardno === '771902417810889' || this.form.bank_cardno === '3602894709100175280'
      || this.form.bank_cardno === '573901340910881' || this.form.bank_cardno === '810000257688000001'  || this.form.bank_cardno === '571917161110607'
      || this.form.bank_cardno === '574909720110301' || this.form.bank_cardno === '32201986448051525480'
      || this.form.bank_cardno === '187267518843') {
          this.vaildCard = true
          return
      }
      return this.$u
          .get("https://ccdcapi.alipay.com/validateAndCacheCardInfo.json", {
            cardNo: this.form.bank_cardno,
            cardBinCheck: true,
          })
          .then((res) => {
            if (!res.validated) {
              uni.showToast({
                icon: "none",
                title: "请输入正确的银行卡号",
              });
              this.vaildCard = false
            } else {
              this.vaildCard = true;
            }
          });
    },
    async submitData() {
      try {
        this.disabledRegisterBtn = true
        this.loadingRegisterBtn = true
        // 注册
        if (!this.doubleClick) {
          this.doubleClick = true
          await this.login();
          this.doubleClick = false
        }
      } catch(e) {
        uni.showToast({
            title: '注册错误:' + e,
            icon: 'error'
        })
      } finally {
        this.disabledRegisterBtn = false
        this.loadingRegisterBtn = false
      }
    },
    cancel() {
      this.showModel = false;
    },
    //显示picker多级联动弹窗
    showPickerMax(e) {
      const _this = this;
      _this.auiPicker.layer = null;
      _this.$refs.picker.open();
    },
    //picker多级联动回调
    pickerCallback(e) {
      // let result = "";
      // e.data.forEach(function (item, index) {
      //   result += item.label + "   ";
      // });
      let data = e.data;
      this.siteItem = data[data.length - 1];
      this.form.site = this.siteItem.label;
    },
    async submit() {
      if (this.reqBankNo) {
        await this.vailCard()
      } else {
        this.vaildCard = true
      }
      this.$refs.uForm.validate(valid => {
        if (valid && this.vaildCard) {
          this.showModel = true;
        } else {
          ui.showModal({
            title: "提示",
            content: "验证失败",
          });
        }
      });

    },
    getDeptId() {
      return this.siteItem ? this.siteItem.id : Number.parseInt(this.urlDeptId)
    },
    async login() {
      let {bank_cardno, referrer_name, referrer_id, referrer_mobile, referrer_company} = this.form;
      let {code, data, msg} = await this.$api.user.bindAndLogin({
        deptId: this.getDeptId(),
        idCardName: this.form.identity_name,
        idCardNo: this.form.identity_number,
        openId: this.openId,
        phonenumber: this.form.mobile,
        code: getQueryString("code"),
        bankName: this.checkBankName.value || "",
        bankCardNo: bank_cardno,
        inductionChannel: this.checkChannel.id,
        recommender: referrer_name == "" ? "无" : referrer_name,
        recommenderId: referrer_id == "" ? "无" : referrer_id,
        recommenderPhonenumber: referrer_mobile == "" ? "无" : referrer_mobile,
        recommendCompany: referrer_company == "" ? "无" : referrer_company,
        inductionType: getUrlParam("type")?(getUrlParam("type") == 'operateRegister'?2:1): 1
      });
      if (code == 200) {
        uni.setStorageSync("token", data.token);
        this.$store.commit("UPDATE_DEPTID", this.getDeptId());
        this.$store.commit("UPDATE_IDCARDNO", this.form.identity_number);
        this.$store.commit("UPDATE_MOBILE", this.form.mobile);

        // 紧急联系人
        let contactList = []
        if (this.rules.emergencyContact[0].required) {
          contactList = [{
            contactsName: this.form.emergencyContact,
            contactsPhonenumber: this.form.contactsPhonenumber,
            contactsRelation: this.checkContactRelation.value || ''
          }]
        }

        const res = await this.$api.riders.register({
          bankName: this.checkBankName.value || "",
          maritalStatus: this.checkMaritalStatus.value || '',
          nation: this.checkNation.value || '',
          highestEducation: this.checkHighestEdu.value || '',
          accountLocation: this.form.accountLocation,
          inductionProvince: this.form.inductionProvince,
          ridInductionContactVoList: contactList,
          storehouseRelativesName: this.form.storehouseRelativesName,
          storehouseRelativesPost: this.form.storehouseRelativesPost,
          storehouseRelativesRelationship: this.checkStorehouseRelativesRelationship.value || '',
          serviceCompanyRelativesName: this.form.serviceCompanyRelativesName,
          serviceCompanyRelativesRelationship: this.checkServiceCompanyRelativesRelationship.value || '',
          serviceCompanyRelativesPost: this.form.serviceCompanyRelativesPost,
          infoChannel: this.checkInfoChannel.value || '',
          secondInterviewTime: this.form.secondInterviewTime,
          healthClaim1: this.form.healthClaim1 === '是' ? 'Y' : 'N',
          healthClaim2: this.form.healthClaim2 === '是' ? 'Y' : 'N',
          healthClaim3: this.form.healthClaim3 === '是' ? 'Y' : 'N',
          healthClaim4: this.form.healthClaim4 === '是' ? 'Y' : 'N',
          healthClaim5: this.form.healthClaim5 === '是' ? 'Y' : 'N',
          hasCriminalRecord: this.form.hasCriminalRecord === '是' ? 'Y': 'N',
          accountNature: this.checkAccountNature.value || '',
          post: this.form.post,
          workplace: this.form.workplace,
          agentName: this.form.agentName,
          businessAddress: this.form.businessAddress,
          email: this.form.email,
          bankAccountName: this.form.bankAccountName,
          bankCardNo: bank_cardno,
          inductionChannel: this.checkChannel.id,
          recommender: referrer_name == "" ? "无" : referrer_name,
          recommenderId: referrer_id == "" ? "无" : referrer_id,
          recommenderPhonenumber: referrer_mobile == "" ? "无" : referrer_mobile,
          recommendCompany: referrer_company == "" ? "无" : referrer_company,
          staffType: this.form.staffType,
          homeAddress: this.form.homeAddress,
          registerType: this.qrCodeType,
          bankCardProvince: this.form.bankCardProvince,
          bankCardCity: this.form.bankCardCity,
          bankCardArea: this.form.bankCardArea,
          qrcodeId: this.qrCodeId,
          idCardAddress: this.form.idCardAddress,
          issuingAuthority: this.form.issuingAuthority,
          idCardBeginDate: this.form.idCardBeginDate,
          idCardEndDate: this.form.idCardEndDate,
          taxVerifyStatus: this.form.taxVerifyStatus,
          bankBranch: this.form.bankBranch,
          unifiedCode: this.form.unifiedCode,
          corporateAccount: this.form.corporateAccount,
          resumeId: uni.getStorageSync("resumeId") ? uni.getStorageSync("resumeId") : '',
          invitationId: uni.getStorageSync("invitationId") ? uni.getStorageSync("invitationId") : '',
          //简历来源
          resumeSource: uni.getStorageSync("resumeSource") ? uni.getStorageSync("resumeSource") : '',
        });
        if (res.code !== 200) {
          this.doubleClick = false
            uni.showToast({
                title: res.msg,
                icon: 'error'
            })
            return
        }
        uni.showToast({
          title: "注册成功",
          icon: "success",
        });
        // this.$u.route("pages/yushen/index");
        // AuthInfo.checkUserStatus();
        let flag = getUrlParam("type")?(getUrlParam("type") == 'operateRegister'?true:false): false
        if (flag == true ) {
          await AuthInfo.checkUserStatus();
          return
        }
        await this.$api.riders.prepareExamineRecord().catch(async()=>{
          await AuthInfo.checkUserStatus();
        });//跳过预审步骤预览
        await AuthInfo.checkUserStatus();
      } else {
        this.doubleClick = false
        uni.showToast({
          title: msg,
          icon: "error",
        });
      }
    },
    async getSite() {
      uni.setStorageSync("token", "");
      let deptId = getQueryString("deptId") == null ? "0" : getQueryString("deptId");
      let res = await this.$api.dept.listDept({deptId});
      this.auiPicker.data = res.data;

      // 新速达挂靠业务美团优选,默认自动选择站点
      if (this.rules.storehouseRelativesName[0].required === true && (deptId === '6652' || deptId === '7021')) {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
        // 临时工修改站点为优选临时工
        if (this.form.staffType === '2') {
            this.form.site = '优选临时工'
        }
      }
      // 新速达挂靠业务快驴,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '6666') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7020') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      // 新速达代理挂靠,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '6713') {
          this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
          this.form.site = this.siteItem.label;
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7031') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      // 新速达挂靠业务网格仓,修改站点/大仓为入职站点
      if (deptId === '6665' || deptId === '7022') {
        this.showSiteLabel = '入职站点'
        this.rules.site[0].message = '请选择入职站点'
        this.auiPicker.title = '选择入职站点'
      }
      // 新速达优选员工,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '6720') {
          this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
          this.form.site = this.siteItem.label;
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7033') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      // 新速达云聘代理对公,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '6728') {
          this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
          this.form.site = this.siteItem.label;
          this.bankNameLabel = '开户银行'
          this.bankNoLabel = '开户银行卡号'
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7032') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
        this.bankNameLabel = '开户银行'
        this.bankNoLabel = '开户银行卡号'
      }
      // 新速达买菜挂靠,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '6667') {
          this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
          this.form.site = this.siteItem.label;
          this.showSiteLabel = '站点'
          this.rules.site[0].message = '请选择站点'
          this.auiPicker.title = '选择站点'
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7030') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
        this.showSiteLabel = '站点'
        this.rules.site[0].message = '请选择站点'
        this.auiPicker.title = '选择站点'
      }
      // 新速达BD挂靠,默认自动选择站点
      if (this.initData.companyId === 101 && this.urlDeptId === '6999') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7026') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      // 挂靠新项目5BD,默认自动选择站点
      if (this.initData.companyId === 521 && this.urlDeptId === '7107') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      if (this.initData.companyId === 7016 && this.urlDeptId === '7118') {
        this.siteItem = this.auiPicker.data[this.auiPicker.data.length - 1];
        this.form.site = this.siteItem.label;
      }
      if(uni.getStorageSync("deptIds")){
        this.siteItem = {
            id    : uni.getStorageSync("deptIds"),
            label : uni.getStorageSync("deptName")
        }
        this.form.site = this.siteItem.label;
      }
    },
    async getInit() {
      let deptId = getQueryString("deptId") == null ? "0" : getQueryString("deptId");
      let invitationId = uni.getStorageSync("invitationId") ? uni.getStorageSync("invitationId") : 'null';
      let channelValue = uni.getStorageSync("channelValue") ? uni.getStorageSync("channelValue") : 'null';
      let resumeName = uni.getStorageSync("resumeName") ? uni.getStorageSync("resumeName") : '';
      let resumeCardNo = uni.getStorageSync("resumeCardNo") ? uni.getStorageSync("resumeCardNo") : '';
      let resumeSource = uni.getStorageSync("resumeSource") ? uni.getStorageSync("resumeSource") : '';
      this.urlDeptId = deptId
      let {data} = await this.$api.riders.registerInit({
        deptId,
        type: this.qrCodeType,
        invitationId: invitationId,
        channelValue: channelValue
      });
      // disabledFlag
      if(resumeName!=null && resumeName!='' && resumeCardNo!=null && resumeCardNo!='') {
        this.disabledFlag = true;
        this.form.identity_name = resumeName;
        this.form.identity_number = resumeCardNo;
      }

      this.form.mobile = uni.getStorageSync("mobile");
      if (this.form.mobile == null || this.form.mobile == "") {
        store.commit("UPDATE_ROUTEURL", "/pages/verify/index");
      }
      this.initData = data;
      this.auiPicker1.data = data.inductionChannels;
      // 初始化员工类型列表
      this.staffTypeList = []
      data.inductionChannels.forEach(item => {
        this.staffTypeList.push({value: item.id, label: item.label})
      })
      data.bankNames &&
      data.bankNames.length > 0 &&
      data.bankNames.forEach((item) => {
        this.actionNameList.push({
          value: item.dictValue,
          label: item.dictLabel,
        });
      });
      if (data.maritalStatusList) {
        data.maritalStatusList.forEach((item) => {
          this.maritalStatusList.push({
            value: item.dictValue,
            label: item.dictLabel
          })
        })
      }
      if (data.nations) {
        data.nations.forEach(item => {
          this.nationList.push({value: item.dictValue, label: item.dictLabel})
        })
      }
      if (data.highestEducations) {
        data.highestEducations.forEach(item => {
          this.highestEduList.push({value: item.dictValue, label: item.dictLabel})
        })
      }
      if (data.emergencyContacts) {
        data.emergencyContacts.forEach(item => {
          this.contactRelationList.push({value: item.dictValue, label: item.dictLabel})
          this.storehouseRelativesRelationshipList.push({value: item.dictValue, label: item.dictLabel})
          this.serviceCompanyRelativesRelationshipList.push({value: item.dictValue, label: item.dictLabel})
        })
      }
      if (data.infoChannelList) {
        data.infoChannelList.forEach(item => {
          this.infoChannelList.push({value: item.dictValue, label: item.dictLabel})
        })
      }
      if (data.accountNatureList) {
          data.accountNatureList.forEach(item => {
              this.accountNatureList.push({value: item.dictValue, label: item.dictLabel})
          })
      }

      if (data.bankName != "") {
        data.bankNames &&
        data.bankNames.length > 0 &&
        data.bankNames.forEach((item) => {
          if (item.dictValue == data.bankName) {
            this.form.bank_name = item.dictLabel;
            this.checkBankName = {
              value: item.dictValue,
              label: item.dictLabel,
            };
          }
        });
      }
      if (data.inductionChannelItem != null) {
        this.checkChannel = data.inductionChannelItem;
        this.form.channel = data.inductionChannelItem.label;

      }
      data.recommender != "" && (this.form.referrer_name = data.recommender);
      data.recommenderId != "" && (this.form.referrer_id = data.recommenderId);
      data.recommenderPhonenumber != "" && (this.form.referrer_mobile = data.recommenderPhonenumber);
      data.recommendCompany != "" && (this.form.referrer_company = data.recommendCompany);
      this.initConfig(data)
    },
    verifyRecommendChannel(id) {
      let showRecommendChannel = this.initData.recommendChannel.indexOf("" + id) != -1
      this.handleRecommendOptions(showRecommendChannel)
      return this.initData.recommendChannel.indexOf("" + id) != -1;
    },
    verifyRecommendThirtyChannel(id) {
      let showChannel = this.initData.recommendThirtyChannel.indexOf("" + id) != -1
      this.handleThirtyCompanyRecommendOptions(showChannel)
      return this.initData.recommendThirtyChannel.indexOf("" + id) != -1;
    },
    handleThirtyCompanyRecommendOptions(showChannel) {
      //TODO 便利达
      let convenientCompanyId = 521
      if (this.checkChannel.id && this.initData.companyId === convenientCompanyId && showChannel) {
        this.reqThirtyCompany = true;
        this.rules.referrer_company = [
          {
            required: true,
            message: "请填写推荐公司名称",
            trigger: ["change", "blur"],
          },
        ]
        this.$refs.uForm.setRules(this.rules)
        return
      }
      this.reqThirtyCompany = false
      delete this.rules['referrer_company']
      this.$refs.uForm.setRules(this.rules)
    },
    handleRecommendOptions(showRecommendChannel) {
      // TODO 推荐人动态配置
      // 新速达
      let speedCompanyId = 101
      // 便利达
      let convenientCompanyId = 521
      // 麦田
      let maiCompanyId = 5357

      if (this.checkChannel.id && this.initData.companyId === speedCompanyId && showRecommendChannel) {
        this.reqReferrerName = true
        this.reqReferrerId = true
        this.reqReferrerMobile = true
        this.rules.referrer_name = [
          {
            required: true,
            message: "请填写推荐人",
            trigger: ["change", "blur"],
          },
        ]
        this.rules.referrer_id = [
          {
            required: true,
            message: "请填写推荐人ID",
            trigger: ["change", "blur"],
          },
        ]
        this.rules.referrer_mobile = [
          {
            required: true,
            message: "请输入填写推荐人手机号",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return this.$u.test.mobile(value);
            },
            message: "推荐人手机号码不正确",
            trigger: ["change", "blur"],
          },
        ]
        this.$refs.uForm.setRules(this.rules)
        return
      }
      if (this.checkChannel.id && this.initData.companyId === convenientCompanyId && showRecommendChannel) {
        this.reqReferrerName = true
        this.reqReferrerId = false
        this.reqReferrerMobile = true
        this.rules.referrer_name = [
          {
            required: true,
            message: "请填写推荐人",
            trigger: ["change", "blur"],
          },
        ]
        this.rules.referrer_mobile = [
          {
            required: true,
            message: "请输入填写推荐人手机号",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return this.$u.test.mobile(value);
            },
            message: "推荐人手机号码不正确",
            trigger: ["change", "blur"],
          },
        ]
        this.$refs.uForm.setRules(this.rules)
        return
      }

      // 麦田科技
      if (this.checkChannel.id && this.initData.companyId === maiCompanyId && showRecommendChannel) {
        this.reqReferrerName = true
        this.reqReferrerId = false
        this.reqReferrerMobile = false
        this.rules.referrer_name = [
          {
            required: true,
            message: "请填写推荐人",
            trigger: ["change", "blur"],
          },
        ]
        // 推荐人ID和推荐人电话置空
        this.form.referrer_id = ''
        this.form.referrer_mobile = ''
        this.$refs.uForm.setRules(this.rules)
        return
      }

      this.reqReferrerName = false
      this.reqReferrerId = false
      this.reqReferrerMobile = false
      delete this.rules['referrer_name']
      delete this.rules['referrer_id']
      delete this.rules['referrer_mobile']
      this.$refs.uForm.setRules(this.rules)
    },
    // 便利达兼职,不校验银行卡和开户银行
    handleBldBank(pickChannel) {
      let riderType = pickChannel[0]
      if (this.initData.companyId === 521) {
        if (riderType.label === '兼职') {
          this.reqBankNo = false
          this.showBankNo = false
          this.rules.bank_name[0].required = false
          this.rules.bank_cardno[0].required = false
          this.$refs.uForm.setRules(this.rules)
        } else {
          this.reqBankNo = true
          this.showBankNo = true
          this.rules.bank_name[0].required = true
          this.rules.bank_cardno[0].required = true
          this.$refs.uForm.setRules(this.rules)
        }
      }
    },
    // 初始化配置
    initConfig(data) {
      // 單晨食品银行卡非必选项
      if (this.initData.companyId && (this.initData.companyId === 5456)) {
        this.reqBankNo = false
        this.showBankNo = true
        this.rules.bank_name[0].required = false
        this.rules.bank_cardno[0].required = false
        this.$refs.uForm.setRules(this.rules)
      } else if (this.initData.companyId && (this.initData.companyId === 5505)) {
        // 广州华源创兴入职渠道和站点非必填项
        this.showSite = false
        this.reqSite = false
        this.reqChannel = false
        this.showChannel = false
        this.rules.channel[0].required = false
        this.rules.site[0].required = false
        this.$refs.uForm.setRules(this.rules)
        this.siteItem = {id: getQueryString("deptId")}
      } else if (this.initData.companyId && (this.initData.companyId === 521) && this.urlDeptId === '5609') {
        this.reqHomeAddress = true
        this.showHomeAddress = true
        this.rules.homeAddress[0].required = true
        this.$refs.uForm.setRules(this.rules)
      }
      // 读取配置
      const formConfigList = data.formConfigList
      if (formConfigList) {
        for (let i = 0; i < formConfigList.length; i++) {
          const item = formConfigList[i]
          const formItemField = item.formItemField
          switch (formItemField) {
            case 'bank_card_no':
              this.rules.bank_cardno[0].required = item.required
              this.reqBankNo = item.required
              this.showBankNo = item.show
              break
            case 'channel':
              this.rules.channel[0].required = item.required
              this.reqChannel = item.required
              this.showChannel = item.show
              break
            case 'site':
              this.rules.site[0].required = item.required
              this.reqSite = item.required
              this.showSite = item.show
              break
            case 'homeAddress':
              this.rules.homeAddress[0].required = item.required
              this.reqHomeAddress = item.required
              this.showHomeAddress = item.show
              break
            case 'bankCardArea':
              this.rules.bankCardArea[0].required = item.required
              this.reqBankCardArea = item.required
              this.showBankCardArea = item.show
              break
            case 'staffType':
              this.rules.staffTypeDesc[0].required = item.required
              this.reqStaffType = item.required
              this.showStaffType = item.show
              break
            case 'maritalStatus':
              this.rules.maritalStatus[0].required = item.required
              this.reqMaritalStatus = item.required
              this.showMaritalStatus = item.show
              break
            case 'nation':
              this.rules.nation[0].required = item.required
              this.reqNation = item.required
              this.showNation = item.show
              break
            case 'highestEdu':
              this.rules.highestEdu[0].required = item.required
              this.reqHighestEdu = item.required
              this.showHighestEdu = item.show
              break
            case 'accountLocation':
              this.rules.accountLocation[0].required = item.required
              this.reqAccountLocation = item.required
              this.showAccountLocation = item.show
              break
            case 'emergencyContact':
              this.rules.emergencyContact[0].required = item.required
              this.rules.contactsRelation[0].required = item.required
              this.reqContact = item.required
              this.showContact = item.show
              break
            case 'emergencyContactPhone':
              this.rules.contactsPhonenumber[0].required = item.required
              this.reqContactPhone = item.required
              this.showContactPhone = item.show
              break
            case 'storehouseRelativesName':
              this.rules.storehouseRelativesName[0].required = item.required
              this.reqStorehouseRelativesName = item.required
              this.showStorehouseRelativesName = item.show
              // 挂靠业务的,修改站点/大仓为大仓
              this.showSiteLabel = '大仓'
              this.rules.site[0].message = '请选择大仓'
              this.auiPicker.title = '选择大仓'
              // 隐藏入职渠道,默认为1-全职,如果二维码携带了staffType参数,则取staffType参数的值
              this.rules.channel[0].required = false
              this.reqChannel = false
              this.showChannel = false
              if (this.staffType) {
                this.form.staffType = this.staffType + ''
              } else {
                this.form.staffType = '1'
              }
              break
            case 'storehouseRelativesPost':
              this.rules.storehouseRelativesPost[0].required = item.required
              this.reqStorehouseRelativesPost = item.required
              this.showStorehouseRelativesPost = item.show
              break
            case 'storehouseRelativesRelationship':
              this.rules.storehouseRelativesRelationship[0].required = item.required
              this.reqStorehouseRelativesRelationship = item.required
              this.showStorehouseRelativesRelationship = item.show
              break
            case 'serviceCompanyRelativesName':
              this.rules.serviceCompanyRelativesName[0].required = item.required
              this.reqServiceCompanyRelativesName = item.required
              this.showServiceCompanyRelativesName = item.show
              break
            case 'serviceCompanyRelativesRelationship':
              this.rules.serviceCompanyRelativesRelationship[0].required = item.required
              this.reqServiceCompanyRelativesRelationship = item.required
              this.showServiceCompanyRelativesRelationship = item.show
              break
            case 'serviceCompanyRelativesPost':
              this.rules.serviceCompanyRelativesPost[0].required = item.required
              this.reqServiceCompanyRelativesPost = item.required
              this.showServiceCompanyRelativesPost = item.show
              break
            case 'healthClaim1':
              this.rules.healthClaim1[0].required = item.required
              this.rules.healthClaim2[0].required = item.required
              this.rules.healthClaim3[0].required = item.required
              this.rules.healthClaim4[0].required = item.required
              this.rules.healthClaim5[0].required = item.required
              this.reqHealthClaim = item.required
              this.showHealthClaim = item.show
              break
            case 'secondInterviewTime':
              this.rules.secondInterviewTime[0].required = item.required
              this.reqSecondInterviewTime = item.required
              this.showSecondInterviewTime = item.show
              break
            case 'inductionProvince':
              this.rules.inductionProvince[0].required = item.required
              this.reqInductionProvince = item.required
              this.showInductionProvince = item.show
              break
            case 'infoChannel':
              this.rules.infoChannel[0].required = item.required
              this.reqInfoChannel = item.required
              this.showInfoChannel = item.show
              break
            case 'accountNature':
              this.rules.accountNature[0].required = item.required
              this.reqAccountNature = item.required
              this.showAccountNature = item.show
              break
            case 'post':
              this.rules.post[0].required = item.required
              this.reqPost = item.required
              this.showPost = item.show
            break
            case 'workplace':
              this.rules.workplace[0].required = item.required
              this.reqWorkplace = item.required
              this.showWorkplace = item.show
            break
            case 'agentName':
              this.rules.agentName[0].required = item.required
              this.reqAgentName = item.required
              this.showAgentName = item.show
            break
            case 'unifiedCode':
              this.rules.unifiedCode[0].required = item.required
              this.reqUnifiedCode = item.required
              this.showUnifiedCode = item.show
              break
            case 'corporateAccount':
              this.rules.corporateAccount[0].required = item.required
              this.reqCorporateAccount = item.required
              this.showCorporateAccount = item.show
              break
            case 'businessAddress':
              this.rules.businessAddress[0].required = item.required
              this.reqBusinessAddress = item.required
              this.showBusinessAddress = item.show
            break
            case 'email':
              this.rules.email[0].required = item.required
              this.reqEmail = item.required
              this.showEmail = item.show
            break
            case 'bankAccountName':
                this.rules.bankAccountName[0].required = item.required
                this.reqBankAccountName = item.required
                this.showBankAccountName = item.show
            break
            case 'hasCriminalRecord':
              this.rules.hasCriminalRecord[0].required = item.required
              this.reqHasCriminalRecord = item.required
              this.showHasCriminalRecord = item.show
            break
            case 'identity_number':
              this.rules.identity_number[0].required = item.required
              this.reqIdCard = item.required
              this.showIdCard = item.show
            break
            case 'idCardAddress':
              this.rules.idCardAddress[0].required = item.required
              this.reqIdCardAddress = item.required
              this.showIdCardAddress = item.show
              break
            case 'issuingAuthority':
              this.rules.issuingAuthority[0].required = item.required
              this.reqIssuingAuthority = item.required
              this.showIssuingAuthority = item.show
              break
            case 'idCardBeginDate':
              this.rules.idCardBeginDate[0].required = item.required
              this.reqIdCardBeginDate = item.required
              this.showIdCardBeginDate = item.show
              break
            case 'idCardEndDate':
              this.rules.idCardEndDate[0].required = item.required
              this.reqIdCardEndDate = item.required
              this.showIdCardEndDate = item.show
              break
            case 'bankBranch':
              this.rules.bankBranch[0].required = item.required
              this.reqBankBranch = item.required
              this.showBankBranch = item.show
              break
          }
        }
        this.initTaxConfig()
        this.$refs.uForm.setRules(this.rules)
      }
    },
    // 处理银行卡所属省份变更事件
    onBankCardAreaConfirm(result) {
      this.form.bankCardProvince = result.province.label
      this.form.bankCardCity = result.city.label
      this.form.bankCardArea = result.area.label
    },
    // 税务配置
    async initTaxConfig() {
      let res = {code: 200, data: {need: true}}
      try {
        res = await this.$api.tax.getEnableTax(this.urlDeptId)
      } catch (e) {
        uni.showToast({
          title: '查询税务配置错误' + e,
          icon: "error",
        });
      }
      if (!res || res.code !== 200) {
        return
      }
      if (res.data.need === true) {
        this.rules.bank_cardno[0].required = true
        this.reqBankNo = true
        this.showBankNo = true
        this.rules.bank_name[0].required = true
        this.rules.idCardAddress[0].required = true
        this.reqIdCardAddress = true
        this.showIdCardAddress = true
        this.rules.issuingAuthority[0].required = true
        this.reqIssuingAuthority = true
        this.showIssuingAuthority = true
        this.rules.idCardBeginDate[0].required = true
        this.reqIdCardBeginDate = true
        this.showIdCardBeginDate = true
        this.rules.idCardEndDate[0].required = true
        this.reqIdCardEndDate = true
        this.showIdCardEndDate = true
        this.rules.bankBranch[0].required = true
        this.reqBankBranch = true
        this.showBankBranch = true
      }
    },
    // 处理身份证有效起期变更事件
    onIdCardBeginDateConfirm(result){
      this.form.idCardBeginDate = `${result.year}-${result.month}-${result.day}`
    },
    // 处理身份证有效止期变更事件
    onIdCardEndDateConfirm(result) {
      this.form.idCardEndDate = `${result.year}-${result.month}-${result.day}`
    },
    // 是否长期身份证变更
    longIdCardChange(e) {
      this.form.idCardEndDate = e === 1 ? '2099-12-31': null
    },
    // 身份证有效止期点击
    onIdCardEndDateClick() {
      if (this.form.isLongIdCard === 1) {
        return
      }
      this.showIdCardEndDatePick = true
    },
    // 处理员工类型确认事件
    onStaffTypeConfirm(e) {
      const staffType = e[0]
      this.form.staffType = staffType.value
      this.form.staffTypeDesc = staffType.label
    }
  },
  // 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
};
</script>

<style lang="scss" scoped>
.form-box {
  padding: 20px;
}

.custom-btn {
  margin: 15px auto;
  left: 50%;
  transform: translateX(-50%);
}
</style>
